#include "Resource.h"

using namespace Stray;
using namespace Stray::Resource;

ResourceID::ResourceID(
	const String& archiveName,
	const String& fileName,
	const String& resourceName,
	const String& type) :
	archiveName_(archiveName), fileName_(fileName), resourceName_(resourceName), type_(type)
{
	hashValue_ = hash_value(*this);
}

bool ResourceID::operator==(const ResourceID& rhs) const
{
	return hashValue_ == rhs.hashValue_;
}

size_t Stray::Resource::hash_value(const ResourceID& id)
{
	size_t h = 0;
	boost::hash_combine(h, id.archiveName_.toString());
	boost::hash_combine(h, id.fileName_.toString());
	boost::hash_combine(h, id.resourceName_.toString());
	boost::hash_combine(h, id.type_.toString());

	return h;
}